<template>
  <div class="tabZujian">

    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane :key="'first'" label="巡检记录" name="first">
        <child1 v-if="isChildUpdate1" />
      </el-tab-pane>

      <el-tab-pane :key="'second'" label="巡检规则" name="second">
        <child2 v-if="isChildUpdate2" />
      </el-tab-pane>
    </el-tabs>

  </div>
</template>

<script>
import pLog from '@/views/psp/polling/pLog'
import rude from '@/views/psp/polling/rude'
export default {
  name: 'Polling',
  components: {
    child1: pLog,
    child2: rude
  },
  data() {
    return {
      // 默认第一个选项卡
      activeName: 'first',
      isChildUpdate1: true,
      isChildUpdate2: false
    }
  },
  mounted() {

  },
  methods: {
    handleClick(tab) {
      if (tab.name === 'first') {
        this.isChildUpdate1 = true
        this.isChildUpdate2 = false
      } else if (tab.name === 'second') {
        this.isChildUpdate1 = false
        this.isChildUpdate2 = true
      }
    }
  }
}
</script>
